﻿//driverwindow.js
/*****************************************************
 * k-phu: 2013/11/22
 * Manage/Driver
 *****************************************************/
 

Ext.QuickTips.init();
function driver(editData, store, isShowInfo) {
	var driverfields = ["driver_id", "driver_name", "driver_age", "driver_email", "driver_phone", "driver_cellphone", "driver_license_model1", "driver_license_model2", "driver_license_model3","driver_creator_type","driver_account","driver_remarks"];
    var driverstore = new Ext.data.Store({
        proxy: new Ext.data.HttpProxy({
            url: "/Home/driverTest",
            method: "POST"
        }),
        reader: new Ext.data.JsonReader({
            fields: driverfields,
            root: "data",
            totalProperty: "totalCount"
        }),
        autoLoad: true
    });
	var txtKey = new Ext.form.TextField({
			allowBlank : true,
			maxLength : 32,
			emptyText : "",
			maxText : 'C_Message_MaxText' + ' 32',
			listeners : {
				specialkey : function (f, o) {

					if (o.getKey() == 13) {
						alert('search');
					}
				}
			}
		});

	var tbar = new Ext.Toolbar({
			items : [
				txtKey,
				{
					tooltip : {
						text : '_POI_Search',
						autoHide : true
					},
					icon : 'Content/images/search16.gif',
					handler : function () {
						alert(1);
					}
				}

			]
		});

	var grid = new Ext.grid.GridPanel({
        store: driverstore,
        columns: [
                { header: '_DriverResource_Name', width: 120, sortable: true, menuDisabled: true, dataIndex: 'driver_name' },
                { header: '_DriverResource_Age', width: 100, sortable: true, menuDisabled: true, dataIndex: 'driver_age' },
                { header: '_DriverResource_Phone', width: 150, sortable: true, menuDisabled: true, dataIndex: 'driver_phone' },
                { header: '_DriverResource_CellPhone', width: 120, sortable: true, menuDisabled: true, dataIndex: 'driver_cellphone' }
            ],
        width: 530,
        height: 200
    });
	var driverwindow = new Ext.Window({
			title : '_DriverResource_Title',
			layout : 'fit',
			height : 250,
			width : 520,
			items : [grid], //grid,
			constrain : true,
			tbar : tbar
		});

	driverwindow.show();
}
